package cn.cxyxj.sso_client_1.event;

import org.springframework.context.ApplicationListener;
import org.springframework.security.authentication.event.AuthenticationSuccessEvent;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * 登陆成功
 */
@Component
public class AuthenticationSuccessEventListener implements ApplicationListener<AuthenticationSuccessEvent> {


    @Override
    public void onApplicationEvent(AuthenticationSuccessEvent authenticationSuccessEvent) {
        /** 获取用户信息-账号/密码 */
        Object principal = authenticationSuccessEvent.getAuthentication().getPrincipal();
        System.out.println(principal.toString());


    }
}